﻿// *****************************************************************
//    Copyright (c) Microsoft. All rights reserved.
//    This code is licensed under the Apache License, Version 2.0.
//    THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
//    ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
//    IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
//    PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
// *****************************************************************

/****************************************************************************
 * FastaP2TestCases.cs
 * 
 *   This file contains the Fasta - Parsers and Formatters Priority Two test cases.
 * 
***************************************************************************/

using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Bio.IO.FastA;
using Bio.Util.Logging;

#if (SILVERLIGHT == false)
    namespace Bio.TestAutomation.IO.FastA
#else
    namespace Bio.SilverLight.TestAutomation.IO.FastA
#endif
{
    /// <summary>
    /// FASTA Priority Two parser and formatter test cases implementation.
    /// </summary>
    [TestClass]
    public class FastAP2TestCases
    {

        /// <summary>
        /// Invalidate close method
        /// </summary>
        [TestMethod]
        [Priority(0)]
        [TestCategory("Priority0")]
        public void FastAFormatterInvalidateClose()
        {
            try
            {
                FastAFormatter formatter = new FastAFormatter();
                formatter.Close();
                Assert.Fail();
            }
            catch (InvalidOperationException ex)
            {
                ApplicationLog.Write("Fasta P2 : InvalidOperationException caught successfully. " + ex.Message);
            }
        }

        /// <summary>
        /// Invalidate Flush method
        /// </summary>
        [TestMethod]
        [Priority(0)]
        [TestCategory("Priority0")]
        public void FastAFormatterInvalidateFlush()
        {
            try
            {
                using (FastAFormatter formatter = new FastAFormatter())
                {
                    formatter.Flush();
                    Assert.Fail();
                }
            }
            catch (InvalidOperationException ex)
            {
                ApplicationLog.Write("Fasta P2 : InvalidOperationException caught successfully. " + ex.Message);
            }
        }

        /// <summary>
        /// Invalidate FormatString method
        /// </summary>
        [TestMethod]
        [Priority(0)]
        [TestCategory("Priority0")]
        public void FastAFormatterInvalidateFormatString()
        {
            ISequence iSeq = null;
            try
            {
                string formattedString = FastAFormatter.FormatString(iSeq);
                Assert.Fail();
            }
            catch (ArgumentNullException ex)
            {
                ApplicationLog.Write("Fasta P2 : ArgumentNullException caught successfully. " + ex.Message);
            }
        }
    }
}
